<%@ page language="java" contentType="text/event-stream" pageEncoding="UTF-8"%>
<%@page import="com.zpyr.common.database.DBManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="javax.sql.DataSource"%>
<%
	response.setHeader("Access-Control-Allow-Origin", "*");
	String lastEventId = request.getHeader("Last-Event-ID");
	
	Class.forName("oracle.jdbc.driver.OracleDriver");
	
	String url = "jdbc:oracle:thin:@oracle.ocpek2.cafe24.com:1521:orcl";
	String user = "OCPEK2";
	String pwd = "ql1010al";
	Connection conn = DriverManager.getConnection(url , user , pwd);
	
	Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE , ResultSet.CONCUR_READ_ONLY);
	String sql = " select name , msg from html5_chat ";
	ResultSet rs = stmt.executeQuery(sql);
	
	%><%="retry:2000\r\ndata:"%><%
	if(rs != null) {
		String name = "";
		String msg = "";
		while(rs.next()) {
			name = rs.getString("name");
			msg =  rs.getString("msg");
			%><%=name+"님의 말 :" + msg%><%
			if(!rs.isLast()) {
				%><%="<br />"%><%
			}
		}
	}
	stmt.close();
	conn.close();
%>